package com.book.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.book.entity.Reader;
import com.book.mapper.ReaderMapper;
import com.book.service.IReaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReaderServiceImpl extends ServiceImpl<ReaderMapper, Reader> implements IReaderService{
    @Autowired
    private ReaderMapper readerMapper;

    @Override
    public List<Reader> getReaders() {
        return baseMapper.selectList(new QueryWrapper<Reader>(null));
    }

    @Override
    public int delReader(String id) {
        return baseMapper.delete(new LambdaQueryWrapper<Reader>().eq(Reader::getId, id));
    }
}
